<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Theory of Operation - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.date.definition.theory.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.date.definition.theory.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.date.introduction.html">Introduction</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.date.html">Zend_Date</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.date.basic.html">Basic Methods</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.date.definition.theory" class="section"><div class="info"><h1 class="title">Theory of Operation</h1></div>
    

    <p class="para">
        Why is there only one class <span class="classname">Zend_Date</span> for handling dates and times in
        Zend Framework?
    </p>

    <p class="para">
        Many languages split the handling of times and calendar dates into two classes. However,
        Zend Framework strives for extreme simplicity, and forcing the developer to manage different
        objects with different methods for times and dates becomes a burden in many situations.
        Since <span class="classname">Zend_Date</span> methods support working with ambiguous dates that
        might not include all parts (era, year, month, day, hour, minute, second, timezone),
        developers enjoy the flexibility and ease of using the same class and the same methods to
        perform the same manipulations (e.g. addition, subtraction, comparison, merging of date
        parts, etc.). Splitting the handling of these date fragments into multiple classes would
        create complications when smooth interoperation is desired with a small learning curve. A
        single class reduces code duplication for similar operations, without the need for a complex
        inheritance hierarchy.
    </p>

    <div class="section" id="zend.date.theory.internals"><div class="info"><h1 class="title">Internals</h1></div>
        

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <acronym class="acronym">UNIX</acronym> Timestamp
                </p>

                <p class="para">
                    All dates and times, even ambiguous ones (e.g. no year), are represented
                    internally as absolute moments in time, represented as a <acronym class="acronym">UNIX</acronym>
                    timestamp expressing the difference between the desired time and
                    January 1st, 1970 00:00:00 <acronym class="acronym">GMT</acronym>. This was only possible,
                    because <span class="classname">Zend_Date</span> is not limited to
                    <acronym class="acronym">UNIX</acronym> timestamps nor integer values. The BCMath extension is
                    required to support extremely large dates outside of the range
                    Fri, 13 Dec 1901 20:45:54 <acronym class="acronym">GMT</acronym> to
                    Tue, 19 Jan 2038 03:14:07 <acronym class="acronym">GMT</acronym>. Additional, tiny math
                    errors may arise due to the inherent limitations of float data types and
                    rounding, unless using the BCMath extension.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    Date parts as timestamp offsets
                </p>

                <p class="para">
                    Thus, an instance object representing three hours would be expressed as
                    three hours after January 1st, 1970 00:00:00 <acronym class="acronym">GMT</acronym>
                    -i.e. 0 + 3 * 60 * 60 = 10800.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <acronym class="acronym">PHP</acronym> functions
                </p>

                <p class="para">
                    Where possible, <span class="classname">Zend_Date</span> usually uses
                    <acronym class="acronym">PHP</acronym> functions to improve performance.
                </p>
            </li>
        </ul>
    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.date.introduction.html">Introduction</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.date.html">Zend_Date</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.date.basic.html">Basic Methods</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="reference.html">Zend Framework Reference</a></li>
  <li class="header up"><a href="zend.date.html">Zend_Date</a></li>
  <li><a href="zend.date.introduction.html">Introduction</a></li>
  <li class="active"><a href="zend.date.definition.theory.html">Theory of Operation</a></li>
  <li><a href="zend.date.basic.html">Basic Methods</a></li>
  <li><a href="zend.date.overview.html">Zend_Date API Overview</a></li>
  <li><a href="zend.date.creation.html">Creation of Dates</a></li>
  <li><a href="zend.date.constants.html">Constants for General Date Functions</a></li>
  <li><a href="zend.date.additional.html">Working Examples</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>